package com.atguigu.hosp.msm.config;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@SpringBootConfiguration
@Data
@ConfigurationProperties(prefix = "aliyun.sms")
public class ConstantPropertiesUtils implements InitializingBean {
    private String regionId;// cn-shenzhen #cn-hangzhou
    private String keyId; // LTAI5t6U6EZC4RRpCtsMBYjr  #你的keyid
    private String keySecret;// UsVolC8vsyVbcHZ4t0S1byixm4LIw5  # 你的keysecret
    private String templateCode; // SMS_217425770 # 你的短信模板code
    private String signName; // 北京课时教育  # 你的短信模板签名

    public static String REGIONID;
    public static String KEYID;
    public static String KEYSECRET;
    public static String TEMPLATECODE;
    public static String SIGNNAME;

    @Value("${weixin.appid}")
    private String appid;

    @Value("${weixin.partner}")
    private String partner;

    @Value("${weixin.partnerkey}")
    private String partnerkey;

    public static String APPID;
    public static String PARTNER;
    public static String PARTNERKEY;


    @Override
    public void afterPropertiesSet() throws Exception {
        REGIONID = regionId;
        KEYID = keyId;
        KEYSECRET = keySecret;
        TEMPLATECODE = templateCode;
        SIGNNAME = signName;

        APPID = appid;
        PARTNER = partner;
        PARTNERKEY = partnerkey;

    }
}
